import db from '../dbserver'
import Sequelize from 'sequelize'

const Device = db.define('device', {
    id: {
        type: Sequelize.INTEGER(11),
        allowNull: false,
        primaryKey: true,
        autoIncrement: true
    },
    barcode: {
        type: Sequelize.STRING(255),
        allowNull: true
    },
    serial_number: {
        type: Sequelize.STRING(255),
        allowNull: true
    },
    kind_code: {
        type: Sequelize.STRING(10),
        allowNull: true
    },
    kind_name: {
        type: Sequelize.STRING(20),
        allowNull: true
    },
    company: {
        type: Sequelize.STRING(50),
        allowNull: true
    },
    department: {
        type: Sequelize.STRING(50),
        allowNull: true
    },
    brand: {
        type: Sequelize.STRING(255),
        allowNull: true
    },
    model: {
        type: Sequelize.STRING(255),
        allowNull: true
    },
    user_name: {
        type: Sequelize.STRING(20),
        allowNull: true
    },
    user_code: {
        type: Sequelize.STRING(20),
        allowNull: true
    },
    type: {
        type: Sequelize.STRING(255),
        allowNull: true
    },
    state: {
        type: Sequelize.STRING(255),
        allowNull: true
    },
    factory_time: {
        type: Sequelize.DATE,
        allowNull: true
    },
    scrap_time: {
        type: Sequelize.DATE,
        allowNull: true
    },
    remarks: {
        type: Sequelize.STRING(255),
        allowNull: true
    },
    isdel: {
        type: Sequelize.INTEGER(1).UNSIGNED.ZEROFILL,
        allowNull: true
    },
    device_drive: {
        type: Sequelize.TEXT,
        allowNull: true
    },
    device_peizhi: {
        type: Sequelize.STRING(5000),
        allowNull: true
    },
    device_baoxiu: {
        type: Sequelize.STRING(5000),
        allowNull: true
    }
}, {
    timestamps: false,
    freezeTableName: true,
    tableName: 'device'
});

export default Device
